local key= KEYS[1]
local expire = tonumber(ARGV[1])
local maxNum = tonumber(ARGV[2])
if (expire ==0 or expire ==nil ) then
    expire = 500
end
local num = tonumber(redis.call('INCRBY',key,"1"))
if (num>maxNum) then
    return -1
end
if(num==1) then
    redis.call('PEXPIRE',key,expire)
end
return 1